package com.zhnl.zhnl_web.controller;

import com.alibaba.fastjson.JSONObject;
import com.zhnl.zhnl_web.service.BstGoodsCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author 罗兴发
 * @data 2025/7/24 9:09
 * @description：分类-控制层
 */
@RestController
@CrossOrigin  //跨域
@RequestMapping("/zhnl_web")
@Slf4j
public class BstGoodsCategoryController {

    @Resource
    BstGoodsCategoryService bstGoodsCategoryService;

    /**
     *
     * 获取所有分类
     *
     * @return
     */
    @GetMapping("/getGoodsCategory")
    public String getGoodsCategory(){
        return bstGoodsCategoryService.getGoodsCategory();
    }

    /**
     *
     * 搜索分类
     *
     * @return
     */
    @PostMapping("/getGoodsCategoryByName")
    public String getGoodsCategoryByName(@RequestBody JSONObject json){
        return bstGoodsCategoryService.getGoodsCategoryByName(json);
    }

    /**
     *
     * 获取热搜分类
     *
     * @return
     */
    @GetMapping("/getGoodsCategoryByHot")
    public String getGoodsCategoryByHot(){
        return bstGoodsCategoryService.getGoodsCategoryByHot();
    }

    /**
     *
     * 获取分类
     *
     * @return
     */
    @GetMapping("/getGoodsCategoryList")
    public String getGoodsCategoryList(){
        return bstGoodsCategoryService.getGoodsCategoryList();
    }

    /**
     *
     * 获取最新企业动态
     *
     * @return
     */
    @PostMapping("/getBusinessTrends")
    public String getBusinessTrends(@RequestBody JSONObject json){
        return bstGoodsCategoryService.getBusinessTrends(json);
    }

    /**
     * 根据id获取图片
     * @param json
     * @return
     */
    @ResponseBody
    @PostMapping("/getCategoryImgById")
    public String getCategoryImgById(@RequestBody JSONObject json){
        return bstGoodsCategoryService.getCategoryImgById(json);
    }
}
